var arr;
$.ajax({
    url: '../server/list.php',
    dataType: "json",
    async:false,
    success(res) {
        var {
            data:phone2
        } = res;
        arr = phone2
        show(phone2,'.phones .morephone')
    }
})
//分页器
layui.use(['laypage', 'layer'], function () {
    var laypage = layui.laypage,
        layer = layui.layer;
    //调用分页
    laypage.render({
        // 显示分页组件的页面元素 标签的id值
        elem: 'test1',
        count: arr.length,
         // 分页组件的排版,
        layout: ['prev', 'page', 'next', 'first', 'skip'],
        //默认每页显示的条数
        limit: 15,
        prev: '上一页',
        next: '下一页',
        first: '首页',
        last: '尾页',
        theme: "#ff6a00",
        jump: function (obj, first) {
            var newarr = [];
            //obj.curr 当前页数
            //obj.limit 每页显示数量
            var a = obj.limit * (obj.curr - 1)
            newarr = arr.slice(a, a + obj.limit)
            show(newarr, ".morephone")
        }
    });
});
